{% load staticfiles %}
{% include "header.html" %}

<div id="all_screen">
    <div class="login-left">
        <a class="login-icon">注册</a>
        {% csrf_token %}
        <form action="/register/" method="post">
            <input id="register-username" name="username" class="login-input" type="text" value="吾之名"
                   onfocus="if(this.value=='吾之名') this.value = '' ">
            <input id="register-password" name="password" class="login-input" type="text" value="吾之剑"
                   onfocus="if(this.value=='吾之剑') {this.value = '';this.type = 'password';} ">
            <input id="register-sibmit" class="login-btn" type="submit" value="注册">
            <a class="login-forget">{{ help }}</a>
            <div class="login-register-box">
                <a class="login-register-help">已有账号?</a>
                <a href="/login" class="login-register">登录</a>
            </div>
            {{ form.errors }}
        </form>
    </div>
    <div class="login-right">
        <a class="login-image-text">从此吾剑将随同在,汝之命运将与吾共存<br>于此,契约完成。</a>

    </div>
</div>

</div>
{% load staticfiles %}
<script src="{% static 'js/jquery-3.1.1.min.js' %}"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>
<script type="text/javascript">
    (function () {
        $('.nav__trigger').on('click', function (e) {
            e.preventDefault();
            $('.nav').toggleClass('nav-active-x');
            $('#nav_trigger_parent').toggleClass('nav-trigger-active')
        });
        $("#all_screen").height($(window).height() - 50);

{#        $('register-sibmit').click(function (e) {#}
{#            e.preventDefault();#}
{#            var username = $('register-username').val();#}
{#            var password = $('register-password').val();#}
{#            $.ajax({#}
{#                url: 'http://192.168.1.104:8000/register',#}
{#                type: 'POST',#}
{#                async: true,#}
{#                data: {#}
{#                    'username': username ,#}
{#                    'password': password#}
{#                },#}
{#                success: function (data, status, xhr) {#}
{#                    window.location.href = 'login.html';#}
{#                },#}
{#                error: function (xhr, status) {#}
{#                    console.log(status + 'Error');#}
{#                }#}
{#            });#}
{#        })#}
    }())
</script>

<script type="text/javascript">
    if (window !== top) top.location = window.location;
</script>
</body>
</html>